<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>swoole-ws测试</h1>
<script>
    var ws = new WebSocket("ws://106.12.201.205:8813");

    ws.onopen = function(evt) {
        console.log("Connection open ...");
        ws.send("Hello WebSockets!");
    };

    ws.onmessage = function(evt) {
        console.log("Received Message: " + evt.data);
        //ws.close();
    };

    ws.onclose = function(evt) {
        console.log("Connection closed.");
    };

    ws.onerror = function (evt, e) {
        console.log("error" + evt.data)
    }
</script>
</body>
</html>